﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization; 

namespace BiffenService.Model
{

    [DataContract]
    public class Show
    {
        private List<Movie> movies;

        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public DateTime StartTime { get; set; }
        [DataMember]
        public int Duration{ get; set; }
        [DataMember]
        public string Description { get; set; }
        [DataMember]
        public Theater Theater { get; set; }
        [DataMember]
        public List<Movie> Movies { get { return movies; } set { movies = value; } }

        public Show()
        {
            movies = new List<Movie>();
        }

        public void AddMovie(Movie movie)
        {
            if (MovieCount() == 0)
            {
                movies.Add(movie);
            }
        }

        public int MovieCount()
        {
            return movies.Count;
        }

        public void setMovies(List<Movie> movies)
        {
            this.movies = new List<Movie>(movies);
        }

        public override string ToString()
        {
            return StartTime.ToShortDateString() + " " + StartTime.ToShortTimeString();
        }

    }
}
